
#ifndef IQW_GUI_FONT_H__
#define IQW_GUI_FONT_H__

#include <stdint.h> 

//#include "iqw_ui_widget_types.h" 
#include "ui_widget_types.h" 

#define FL_HEADER_INFO_OFFSET       (0)
#define FL_SECTION_INF_OFFSET       (0x10)




typedef struct{
    uint32_t    magic;
    uint32_t    size;

    uint8_t     num_of_section;
    uint8_t     height_of_font;
    uint16_t    code_flag;

    // uint8_t     reserved[4];
}fl_header_t; 

typedef struct{
    uint16_t    first;
    uint16_t    last;
    uint32_t    offset; 
}fl_section_inf_t; 

typedef struct{
    uint32_t    offset: 26;
    uint32_t    width:  6; 
}fl_unicode_t; 

typedef struct{
    int initialized; 
    fl_header_t         header;
    fl_section_inf_t    section_inf; 
}font_lib_t; 
typedef struct{
    uint32_t offset: 26;
    uint32_t maxwidth: 6;
}font_lib_data_t; 
typedef struct{
    const fl_header_t *       p_header;
    const fl_section_inf_t*   p_section;

    font_lib_data_t     params;    
}font_struct_t; 

int iqw_gui_font_get_fixed_height(uint16_t fontasset); 

//iqw_gui_font_size_t iqw_gui_font_get_fontsize( iqw_ui_fontsize_t size ); 

int iqw_gui_font_get_font_library_unicode_width(uint16_t unicode, int fontsize); 

int iqw_gui_font_get_unicode_address(uint16_t unicode, fl_unicode_t *fl, int fontsize); 

int iqw_gui_font_get_font_library_by_unicode(uint16_t unicode, uint8_t *data, int fontsize);

//int iqw_gui_font_get_image(uint32_t index, uint16_t no, iqw_res_image_t * image); 

//void iqw_gui_font_get_image_offset( iqw_res_image_t *image, int offset); 

//void iqw_gui_font_get_image_raw_value( uint32_t offset, uint8_t *data, uint16_t size ); 

#endif 
